home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / news / readers / nn-tk.001 / nn-tk~ / nn / chset.c < prev    next >
C/C++ Source or Header  |  1995-07-25  |  791b  |  45 lines

  1. /*
  2.  *    (c) Copyright 1992, Luc Rooijakkers.  All rights reserved.
  3.  *
  4.  *    Character set support (rudimentary)
  5.  */
  6.  
  7. #include "config.h"
  8. #include "chset.h"
  9.  
  10. static struct chset chsets[]= {
  11.     "us-ascii",        7,
  12.     "iso-8859-1",    8,
  13.     "iso-8859-2",    8,
  14.     "iso-8859-3",    8,
  15.     "iso-8859-4",    8,
  16.     "iso-8859-5",    8,
  17.     "iso-8859-6",    8,
  18.     "iso-8859-7",    8,
  19.     "iso-8859-8",    8,
  20.     "iso-8859-9",    8,
  21.     "koi8-r",           8,
  22.     "unknown",        0,
  23.     NULL,        0,
  24. };
  25.  
  26. export struct chset *curchset = chsets;
  27.  
  28. struct chset *getchset(name)
  29. char *name;
  30. {
  31.     struct chset *csp;
  32.     char *sp;
  33.  
  34.     for (sp = name; *sp; sp++)
  35.     if (isupper(*sp))
  36.         *sp = tolower(*sp);
  37.  
  38.     for (csp = chsets; csp->cs_name != NULL; csp++) {
  39.     if (strcmp (csp->cs_name, name) == 0)
  40.         return csp;
  41.     }
  42.  
  43.     return NULL;
  44. }
  45.